﻿/*--------------------------------------------------------------------------------
 * Adaptive Intelligence - Foundation Framework
 * Version 2.10
 * 
 * CNR Command Parameter Base Class
 *      Provides an internal base definition for specifying the command parameter
 * type as a non-generic type name for the collection class.
 *------------------------------------------------------------------------------*/

/*--------------------------------------------------------------------------------
 * System Imports
 *------------------------------------------------------------------------------*/
using System;
using Adaptive.Foundation;

namespace Adaptive.Foundation.Network.Cnr
{
    /// <summary>
    /// Provides an internal base definition for specifying the command parameter
    /// type as a non-generic type name for the collection class.
    /// </summary>
    /// <remarks>
    /// The actual CNR Command parameter class is declared as a generic type to support
    /// multiple data types for command parameters.  In order to provide a method around
    /// C#'s limitation for generic variance, this base class exists to provide a singlular
    /// definition for the related collection class' type name parameter.
    /// 
    /// See: <see cref="CnrCommandParameterCollection"/>
    /// </remarks>
    public abstract class CnrCommandParameterBase : CnrObjectBase
    {
        /*--------------------------------------------------------------------------------
         * Constructor / Dispose / Destructor Methods
         *------------------------------------------------------------------------------*/
        #region Constructor / Dispose / Destructor Methods
        /// <summary>
        /// Initializes a new instance of the class.
        /// </summary>
        /// <param name="parameterName">
        /// The name assigned to the parameter.
        /// </param>
        protected CnrCommandParameterBase(string parameterName)
            : base()
        {
            Name = parameterName;
        }
        #endregion

        /*--------------------------------------------------------------------------------
         * Protected Methods / Event Methods
         *------------------------------------------------------------------------------*/
        #region Protected Methods / Event Methods
        /// <summary>
        /// Renders the parameter value.
        /// </summary>
        /// <returns>
        /// A string containing the parameter data.
        /// </returns>
        protected abstract string RenderParameter();
        /// <summary>
        /// Renders the parameter value.
        /// </summary>
        /// <returns>
        /// A string containing the parameter data.
        /// </returns>
        protected abstract string RenderParameter(CnrDataRendererBase renderer);
        /// <summary>
        /// Renders the parameter value.
        /// </summary>
        /// <returns>
        /// A string containing the parameter data.
        /// </returns>
        protected abstract void ParseParameter(CnrDataParserBase parser, string originalData);
        /// <summary>
        /// Validates the parameter definition and content.
        /// </summary>
        /// <returns>
        /// Returns <b>false</b>.
        /// </returns>
        protected abstract bool ValidateParameter();
        #endregion
    }
}
